package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.Intention;


import java.util.List;

public interface IntentionMapper {
    @Select("select * from Intention")
        List<IntentionMapper> selectAll();

    @Insert("insert into Intention values(tenantId,houseType,area" +
            ",floor,parkPlace,tenancy,orientate,greenery,trafficConvenient" +
            ",shoppingConvenient,schoolNearbyHouse,fridge,television" +
            ",washingMachine,geyser,airCondition,broadband,sofa,bed,heat" +
            ",wardrobe,cookingable,bathroom,balcony,intelligentLock" +
            ",rangeHood,gasStove)")
    void insert(IntentionMapper intention);
    @Update("update Intention set tenant_id=#{tenantId},house_type=#{houseType},area=#{area},floor=#{floor}" +
            ",park_place=#{parkPlace},tenancy=#{tenancy},orientate=#{orientate},greenery=#{greenery}" +
            ",television=#{television},washing_machine=#{washingMachine},geyser=#{geyser},air_condition=#{airCondition}" +
            ",broadband=#{broadband},sofa=#{sofa},bed=#{bed},heat=#{heat}" +
            ",wardrobe=#{wardrobe},cookingable=#{cookingable},bathroom=#{bathroom},balcony=#{balcony}" +
            ",intelligent_lock=#{intelligentLock},range_hood=#{rangeHood},gas_stove=#{gasStove} where id=#{Id}")
    void  updateByPrimaryKey(IntentionMapper intention);

    @Delete("delete from Intention where id=#{Id}")
    void deleteByPrimaryKey(Integer id);


    @Select("select * from Intention where tenant_id=#{tenantId}")
    Intention selectById(Integer tenantId);


    @Update("update Intention set greenery=#{greenery}," +
            "television=#{television}," +
            "washing_machine=#{washingMachine}," +
            "geyser=#{geyser}," +
            "air_condition=#{airCondition}," +
            "broadband=#{broadband}," +
            "sofa=#{sofa}," +
            "bed=#{bed}," +
            "heat=#{heat}," +
            "wardrobe=#{wardrobe}," +
            "cookingable=#{cookingable}," +
            "bathroom=#{bathroom}," +
            "balcony=#{balcony}," +
            "intelligent_lock=#{intelligentLock}," +
            "gas_stove=#{gasStove}," +
            "range_hood=#{rangeHood},"+
            "fridge=#{fridge},"+
            "school_nearby_house=#{schoolNearbyHouse},"+
            "traffic_convenient=#{trafficConvenient},"+
            "shopping_convenient=#{shoppingConvenient} "+
            "where tenant_id=#{tenantId}")
    int  updateByTenantId(Intention intention);


    @Update("update intention set house_type=#{houseType},floor=#{floor},park_place=#{parkPlace},orientate=#{orientate} where tenant_id=#{tenantId}")
    int  updateDemandByTenantId(Intention intention);


}
